package com.wms.web.controller.wcs;


import com.wms.common.core.controller.BaseController;
import com.wms.common.core.domain.AjaxResult;
import com.wms.common.core.page.TableDataInfo;
import com.wms.system.domain.wcs.PackingExcelTemplate;
import com.wms.system.domain.wcs.ProjectInventory;
import com.wms.system.service.wcs.IPackingExcelTemplateService;
import com.wms.system.service.wcs.IProjectInventoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "模板管理")
@RestController
@RequestMapping("/wcs/packingExcelTemplate")
public class PackingExcelTemplateController extends BaseController {
    @Autowired
    private IPackingExcelTemplateService packingExcelTemplateService;

    /**
     * 获取存货管理信息列表
     */
    @ApiOperation("获取模板信息列表")
    @GetMapping("/list")
    public TableDataInfo list(PackingExcelTemplate packingExcelTemplate) {
        startPage();
        List<PackingExcelTemplate> list = packingExcelTemplateService.queryList(packingExcelTemplate);
        return getDataTable(list);
    }


    /**
     * 新增模板管理信息
     */
    @PostMapping(value = "/add")
    @ApiOperation("新增模板管理信息")
    public AjaxResult add(@RequestBody PackingExcelTemplate packingExcelTemplate) {
        packingExcelTemplateService.insert(packingExcelTemplate);
        return AjaxResult.success();
    }

    /**
     * 修改模板管理
     */
    @ApiOperation("修改模板管理信息")
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody PackingExcelTemplate packingExcelTemplate) {
        packingExcelTemplateService.update(packingExcelTemplate);
        return AjaxResult.success();
    }


    /**
     * 批量删除
     */
    @ApiOperation("批量删除模板管理信息")
    @GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        packingExcelTemplateService.delete(ids);
        return AjaxResult.success();
    }

}
